<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

	public function _initAutoLoad()
	{
		
		// initialize the core of application - autoloader 
    	$autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader->setFallbackAutoloader(true);
        
        // create a config object ( to get a language option )  
        $config = new Zend_Config($this->getOptions(), true);
 	    Zend_Registry::set('config', $config);
        
        // set the global language of application 
        $localeValue = $config->lang ;
        $locale = new Zend_Locale($localeValue);
	    
        //registry a public class translation  
        Zend_Registry::set('Zend_Locale', $locale);
	    $translationFile = APPLICATION_PATH. DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $localeValue . '.inc.php';
	    
	    // initialize the core of translation 
	    $translate = new Zend_Translate('array', $translationFile, $localeValue);
	    Zend_Registry::set('Zend_Translate', $translate);
	    
		// authentication 	    
	    $storage = new Zend_Auth_Storage_Session();
	    $data = $storage->read();
	    Zend_Registry::set('authetication', $data);
	    
	    
	    // project 
	    $project = "2" ; 
	    Zend_Registry::set('project', $project);
	     
	     

	    
	    
	    
	    // verify permissions
	    include("../library/Acl.php") ;
	    $acl = new Acl() ;
	//    if($acl->isAllowed()=="deny") echo "nao logado" ;  
	    
	    
	    
	    
	    
	    
	    //header('Location: /svnapproval/index/login/') ; 
	    
	    
	    /*$acl = new Acl() ;
	    if($acl->isAllowed()=="deny") header('Location: /katara/deny') ;    
		*/ 
		
		
	}
	
	
	
	public function translate()
	{
		 
		// create a config object ( to get a language option )
		$config = new Zend_Config($this->getOptions(), true);
		Zend_Registry::set('config', $config);
	
		// set the global language of application
		$localeValue = $config->lang ;
		$locale = new Zend_Locale($localeValue);
		 
		//registry a public class translation
		Zend_Registry::set('Zend_Locale', $locale);
		$translationFile = APPLICATION_PATH. DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $localeValue . '.inc.php';
		 
		// initialize the core of translation
		$translate = new Zend_Translate('array', $translationFile, $localeValue);
		Zend_Registry::set('Zend_Translate', $translate);
		 
		return $translate ;
		 
		 
	}
	
	

}

